package com.buba.system.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.buba.pojo.system.NewsBulletin;
import com.buba.pojo.user.Campus;
import com.buba.system.mapper.NewsBulletinMapper;
import com.buba.system.service.NewsBulletinService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.buba.utils.R;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 消息公告表 服务实现类
 * </p>
 *
 * @author testjava
 * @since 2022-06-09
 */
@Service
public class NewsBulletinServiceImpl extends ServiceImpl<NewsBulletinMapper, NewsBulletin> implements NewsBulletinService {

    @Override
    public R findAllNews() {
        List<NewsBulletin> newsBulletinList = this.list(new QueryWrapper<NewsBulletin>().eq("news_state","1"));
        return R.ok().data("list", newsBulletinList);
    }

    @Override
    public R findByNewsID(Integer id) {
        NewsBulletin newsBulletin = baseMapper.selectById(id);
        return R.ok().data("newsBulletin", newsBulletin);
    }


}
